package com.xxwy.ddu.common.util;

import java.text.SimpleDateFormat;

/**
 * @author xxwy
 * on 2018/8/13 0013
 */
public class DateUtil {

    /**
     * 传入时间差，得到具体分
     * @param time
     * @return
     */
    public static String parseSs(Long time){
        if (time != null) {
            return  time/1000 + "s";
        }return null;

    }

    public static String parse(Long time){
        if (time != null) {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time);
        }
        return null;
    }

    public static String parse(Long time,String pattern){
        if (time != null) {
            if (pattern == null) {
                return parse(time);
            }
           return new SimpleDateFormat(pattern).format(time);
        }
        return null;
    }
}
